package com.wxzz.elearing.comment.api.admin;


import com.alibaba.fastjson.JSONObject;
import com.wxzz.elearing.comment.dto.BannedDto;
import com.wxzz.elearing.comment.dto.BannedListDto;
import com.wxzz.elearing.comment.dto.StudyQuestionsAnswersDto;
import com.wxzz.elearing.comment.entity.Banned;
import com.wxzz.elearing.comment.service.IBannedService;
import com.wxzz.elearing.comment.vo.StudyQuestionsAnswersListVo;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 
 * @since 2021-06-15
 */
@RestController
@RequestMapping("/banned")
@Api(tags = "企业封禁接口(企业)")
public class BannedController {

    @Resource
    private IBannedService iBannedService;

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @ApiOperation(value = "企业社区添加封禁(企业)", notes = "企业社区添加封禁(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "addCommunityBanned", method = RequestMethod.POST)
    public ReturnVO addCommunityBanned(@RequestBody Banned banned) {
        return iBannedService.addCommunityBanned(banned);
    }

    @ApiOperation(value = "企业社区解除封禁(企业)", notes = "企业社区解除封禁(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "deleteCommunityBanned", method = RequestMethod.POST)
    public ReturnVO deleteCommunityBanned(@RequestBody Banned banned) {
        return iBannedService.deleteCommunityBanned(banned);
    }


    @ApiOperation(value = "企业问答添加封禁(企业)", notes = "企业问答添加封禁(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "addQueAnsBanned", method = RequestMethod.POST)
    public ReturnVO addQueAnsBanned(@RequestBody Banned banned) {
        return iBannedService.addQueAnsBanned(banned);
    }

    @ApiOperation(value = "企业问答解除封禁(企业)", notes = "企业问答解除封禁(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "deleteQueAnsBanned", method = RequestMethod.POST)
    public ReturnVO deleteQueAnsBanned(@RequestBody Banned banned) {
        return iBannedService.deleteQueAnsBanned(banned);
    }

    @ApiOperation(value = "企业社区封禁列表(企业)", notes = "企业社区封禁列表(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "listCommunityBanned", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<BannedListDto>>> listCommunityBanned(@RequestBody BannedDto bannedListDto) {
        return iBannedService.listCommunityBanned(bannedListDto);
    }

    @ApiOperation(value = "企业问答封禁列表(企业)", notes = "企业问答封禁列表(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "listQueAnsBanned", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<BannedListDto>>> listQueAnsBanned(@RequestBody BannedDto bannedListDto) {
        return iBannedService.listQueAnsBanned(bannedListDto);
    }

    @ApiOperation(value = "导出企业社区封禁列表(企业)", notes = "导出企业社区封禁列表(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "exportCommunityExcel", method = RequestMethod.POST)
    public void exportCommunityExcel(HttpServletResponse response){
        iBannedService.exportCommunityExcel(response);
    }

    @ApiOperation(value = "导出企业问答封禁列表(企业)", notes = "导出问答社区封禁列表(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "exportQueAnsExcel", method = RequestMethod.POST)
    public void exportQueAnsExcel(HttpServletResponse response){
        iBannedService.exportQueAnsExcel(response);
    }
}
